﻿Imports TransportadoraToledoBLL

Public Class frm_parametros


    Private Sub bConfirmar_Click(sender As System.Object, e As System.EventArgs) Handles bConfirmar.Click
        Try
            Dim placa As String
            Dim frm As New frm_relatorio
            Dim rpt As New rel_abastecimentos
            Dim dtInicial As Date
            Dim dtFim As Date
            If (tbPlacaVeiculo.Text <> "") Then
                placa = tbPlacaVeiculo.Text
            Else
                placa = ""
            End If
            dtInicial = dtInicio.Value.Date
            dtFim = dtFinal.Value.Date
            'rpt.SetParameterValue(0, placa)
            'rpt.SetParameterValue(1, dtInicial)
            'rpt.SetParameterValue(2, dtFim)
            rpt.ParameterFields.Item(0).CurrentValues.AddValue(placa)
            rpt.ParameterFields.Item(1).CurrentValues.AddValue(dtInicial)
            rpt.ParameterFields.Item(2).CurrentValues.AddValue(dtFim)
            'comentei a linha abaixo pois estava dando erro ao executar o sistema - Álvaro Oliveira
            frm.crvRelatorios.ReportSource = rpt
            frm.Text = "Relátorio de Abastecimentos"
            frm.ShowDialog()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub bCancelar_Click(sender As System.Object, e As System.EventArgs) Handles bCancelar.Click
        Me.Close()
    End Sub

    Private Sub bVeiculos_Click(sender As System.Object, e As System.EventArgs) Handles bVeiculos.Click
        Dim objC As VeiculosBLL
        Try
            Dim frm As New frm_consultas
            objC = New VeiculosBLL
            frm.tipo = "Veiculos"
            frm.ShowDialog()
            If (frm.codigo <> 0) Then
                objC.localizar(frm.codigo)
                tbPlacaVeiculo.Text = objC.pPlaca
            End If
            frm = Nothing
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Erro")
        Finally
            objC = Nothing
        End Try
    End Sub

    Private Sub frm_parametros_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class